function processNotification( n )

    % get the event associated with this notification from handler
    event = n.getSource().getEventWithRemove(n.uuid);

    % First forward the event to any TWS Notification listeners
    notify(                               ...
       TWS.Events.getInstance()         , ...
       TWS.Events.NOTIFICATION          , ...
       TWS.EventData.Notification(event)  ...
      );
  
    switch class(event)
        
        case 'com.tws.Handler$TickByTickAllLastEvent'
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.TICKBYTICK_ALLLAST        , ...
                TWS.EventData.TickByTickAllLast(event) ...
            );
        
        case 'com.tws.Handler$TickByTickBidAskEvent'
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.TICKBYTICK_BIDASK         , ...
                TWS.EventData.TickByTickBidAsk(event)  ...
            );
        
        case 'com.tws.Handler$TickByTickMidPointEvent'
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.TICKBYTICK_MIDPOINT       , ...
                TWS.EventData.TickByTickMidPoint(event)...
            );
        
        case 'com.tws.Handler$MarketDepthEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.MARKETDEPTH               , ...
                TWS.EventData.MarketDepth(event)       ...
            );
        
        case 'com.tws.Handler$MarketDataEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.MARKETDATA                , ...
                TWS.EventData.MarketData(event)        ...
            );
            
        case 'com.tws.Handler$MarketMetadataEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.MARKETMETADATA            , ...
                TWS.EventData.MarketMetadata(event)    ...
            );

        case 'com.tws.Handler$RealTimeBarEvent'

            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.REALTIMEBAR               , ...
                TWS.EventData.RealTimeBar(event)       ...
            );

        case 'com.tws.Handler$HistoricalDataEvent'

            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.HISTORICALDATA            , ...
                TWS.EventData.HistoricalData(event)    ...
              );

        case 'com.tws.Handler$AccountSummaryEvent'

            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.ACCOUNTSUMMARY            , ...
                TWS.EventData.AccountSummary(event)    ...
            );
          
        case 'com.tws.Handler$AccountUpdateEvent'

            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.ACCOUNTUPDATE             , ...
                TWS.EventData.AccountUpdate(event)     ...
            );

        case 'com.tws.Handler$PositionsEvent'

            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.POSITIONS                 , ...
                TWS.EventData.Positions(event)         ...
            );            
            
        case 'com.tws.Handler$ContractDetailsEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.CONTRACTDETAILS           , ...
                TWS.EventData.ContractDetails(event)   ...
            );
        
        case 'com.tws.Handler$OpenOrderEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.OPENORDER                 , ...
                TWS.EventData.OpenOrder(event)         ...
            );
        
        case 'com.tws.Handler$OrderStatusEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.ORDERSTATUS               , ...
                TWS.EventData.OrderStatus(event)       ...
            );
        
        case 'com.tws.Handler$ExecutionDetailsEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.EXECUTIONDETAILS          , ...
                TWS.EventData.ExecutionDetails(event)  ...
            );
        
        case 'com.tws.Handler$PortfolioUpdateEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.PORTFOLIOUPDATE           , ...
                TWS.EventData.PortfolioUpdate(event)   ...
            );
        
        case 'com.tws.Handler$NextOrderIdEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.NEXTORDERID               , ...
                TWS.EventData.NextOrderId(event)       ...
            );
        
        case 'com.tws.Handler$ScannerDataEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.SCANNERDATA               , ...
                TWS.EventData.ScannerData(event)       ...
            );
        
        case 'com.tws.Handler$OptionComputationEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.OPTIONCOMPUTATION         , ...
                TWS.EventData.OptionComputation(event) ...
            );
        
        case 'com.tws.Handler$ErrorEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.ERROR                     , ...
                TWS.EventData.Error(event)             ...
            );
        
        case 'com.tws.Handler$TimeEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.TIME                      , ...
                TWS.EventData.Time(event)              ...
            );
        
        case 'com.tws.Handler$ConnectionClosedEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.CONNECTIONCLOSED          , ...
                TWS.EventData.ConnectionClosed(event)  ...
            );
        
        case 'com.tws.Handler$CommissionReportEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.COMMISSIONREPORT          , ...
                TWS.EventData.CommissionReport(event)  ...
            );
        
        case 'com.tws.Handler$MarketRuleEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.MARKETRULE                , ...
                TWS.EventData.MarketRule(event)        ...
            );
        
        case 'com.tws.Handler$HeadTimestampEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.HEADTIMESTAMP             , ...
                TWS.EventData.HeadTimestamp(event)     ...
            );
        
        case 'com.tws.Handler$FinancialAdvisoryEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.FINANCIALADVISORY         , ...
                TWS.EventData.FinancialAdvisory(event) ...
            );
        
        case 'com.tws.Handler$FundamentalDataEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.FUNDAMENTALDATA           , ...
                TWS.EventData.FundamentalData(event)   ...
            );
        
        case 'com.tws.Handler$SymbolSampleEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.SYMBOLSAMPLE              , ...
                TWS.EventData.SymbolSample(event)      ...
            );
        
        case 'com.tws.OptionParameterEvent'
            
            notify(                                    ...
                TWS.Events.getInstance()             , ...
                TWS.Events.CONTRACTDETAILS           , ...
                TWS.EventData.OptionParameter(event)   ...
            );
        
        otherwise
            warning(['could not process event: ',class(e)])
    end
end